Part Number Hot Search : 
1N4773A UCC25 DB102 SF400 21045 MP7720DS LBN7001 LR745N3
Product Description
Full Text Search
 

To Download AN107 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  application note AN107 AN107-1 interfacing the x84641/129 mps e 2 prom to 8051 microcontrollers by applications staff, may 1997 the mps e 2 prom is an attractive alternative to the 'add-on' parallel or serial nonvolatile memories that have traditionally been used in microcontroller-based systems. it features serial e 2 prom memory that is accessed via a standard parallel bus. the serial archi- tecture of the x84641/129 provides a cost and space saving replacement for low density parallel devices. its unique parallel bus compatible interface also offers an i/o-saving alternative to serial devices that typically require two or three control pins for communication pur- poses. although the x84641/129 can be used to inter- face with practically any 8, 16, or 32-bit microcontroller, the code provided here is for the widely used 8051 family. additional code can be found on the xicor web site that will implement interfaces between the 8051 micro- controller family and other xicor serial devices. xicor application notes are available from the www using the url: http://www.xicor.com. vcc vcc u3 80c31 ea/vp 31 x1 19 x2 18 reset 9 int0 12 int1 13 t0 14 t1 15 p1.0 1 p1.1 2 p1.2 3 p1.3 4 p1.4 5 p1.5 6 p1.6 7 p1.7 8 p0.0 39 p0.1 38 p0.2 37 p0.3 36 p0.4 35 p0.5 34 p0.6 33 p0.7 32 p2.0 21 p2.1 22 p2.2 23 p2.3 24 p2.4 25 p2.5 26 p2.6 27 p2.7 28 rd 17 wr 16 psen 29 ale/p 30 txd 11 rxd 10 u1 x84041 i/o 2 wp 3 oe 6 we 5 ce 1 nc 7 u2 74ls138 a 1 b 2 c 3 g1 6 g2a 4 g2b 5 y0 15 y1 14 y2 13 y3 12 y4 11 y5 10 y6 9 y7 7 figure 1. one way to interface an x84641/129 to 8051 microcontrollers
xicor application note AN107-2 AN107 $ title(x84xxx/8031/1.0) ;****************************************************************************************** ;* the purpose of this code is to provide routines to interface the xicor mps eeprom ;* with the 8031 microcontroller. the interface uses the 8031's parallel bus and connects the ;* microcontroller's /rd strobe to the mps eeproms /oe pin, /wr strobe to the /we pin, and ;* decodes address pins a13, a14, a15 for /cs. address space e000 - ffff is used to select the ;* mps eeprom. all mps eeprom commands are provided. these are :- ;* 1. single byte write ;* 2. single byte read ;* 3. page write ;* 4. sequential read ;* the code performs a byte write of 11h to eeprom address 0; a byte read from eeprom address ;* 0; a page write of 22h, 33h, 44h to eeprom addresses 100h, 101h, 102h; and a sequential ;* read from eeprom addresses 100h, 101h, 102h. ;****************************************************************************************** ;* constants byte_addr equ 0f000h ; address used for single byte operation byte_data equ 11h ; data used for single byte write operation page_addr equ 0f100h ; address used for page operation page_data1 equ 22h ; 1st data used for page write operation page_data2 equ 33h ; 2nd data used for page write operation page_data3 equ 44h ; 3rd data used for page write operation slic equ 030h ; address location of slic ;****************************************************************************************** ;* internal ram ;****************************************************************************************** stack_top equ 060h ; stack top ;****************************************************************************************** ;* code ;****************************************************************************************** org 0000h ; reset vectors to this location jmp main org 0100h main: mov sp, #stack_top ; initialize stack pointer clr ea ; disable interupts lcall byte_write ; write 11h to address 0 (single byte write) lcall byte_read ; read from address 0 (single byte read) lcall page_write ; write 22/33/44h to addresses 100/1/2h (page write) lcall sequ_read ; read from addresses 100h,101h,102h (sequential read) ljmp slic
AN107-3 xicor application note AN107 ;****************************************************************************************** ;* name: byte_write ;* description: single byte write ;* function: this routine sends the command sequence to write a single byte to eeprom ;* calls: rst, load_byte, nv_start, nv_poll ;* input: none ;* outputs: none ;* register usage: a ;****************************************************************************************** byte_write: mov dptr, #byte_addr lcall rst ; issue a reset sequence mov a, dph lcall load_byte ; load high order address byte mov a, dpl lcall load_byte ; load low order address byte mov a, #byte_data lcall load_byte ; load data byte lcall nv_start ; start nonvolatile write cycle lcall nv_poll ; poll for completion of write cycle ret ;****************************************************************************************** ;* name: page_write ;* description: page write ;* function: this routine sends the command sequence to write three consecutive bytes ;* calls: rst, load_byte, nv_start, nv_poll ;* input: none ;* outputs: none ;* register usage: a ;****************************************************************************************** page_write: mov dptr, #page_addr lcall rst ; issue a reset sequence mov a, dph lcall load_byte ; load high order address byte mov a, dpl lcall load_byte ; load low order address byte mov a, #page_data1 lcall load_byte ; load 1st data byte mov a, #page_data2 lcall load_byte ; load 2nd data byte mov a, #page_data3 lcall load_byte ; load 3rd data byte lcall nv_start ; start nonvolatile write cycle lcall nv_poll ; poll for completion of write cycle ret
xicor application note AN107-4 AN107 ;****************************************************************************************** ;* name: byte_read ;* description: single byte read ;* function: this routine sends the command sequence to read a single byte from the eeprom ;* calls: rst, load_byte, rec_byte ;* input: none ;* outputs: a = byte read ;* register usage: a ;****************************************************************************************** byte_read: mov dptr, #byte_addr lcall rst ; issue a reset sequence mov a, dph lcall load_byte ; load high order address byte mov a, dpl lcall load_byte ; load low order address byte lcall rec_byte ; receive data byte ret ;****************************************************************************************** ;* name: sequ_read ;* description: sequential read ;* function: this routine sends the command sequence to read three consecutive bytes ;* calls: rst, load_byte, rec_byte ;* input: none ;* outputs: a = last byte read ;* register usage: a ;****************************************************************************************** sequ_read: mov dptr, #page_addr lcall rst ; issue a reset sequence mov a, dph lcall load_byte ; load high order address byte mov a, dpl lcall load_byte ; load low order address byte lcall rec_byte ; receive 1st data byte lcall rec_byte ; receive 2nd data byte lcall rec_byte ; rceive 3rd data byte ret ;****************************************************************************************** ;* name: load_byte ;* description: loads byte to eeprom ;* function: this routine loads a byte, msb first, to the eeprom ;* calls: none ;* input: none ;* outputs: none ;* register usage: r0, a ;****************************************************************************************** load_byte: mov r0, #08 ; set bit counter to eight loop1: rl a ; rotate accumulator left
AN107-5 xicor application note AN107 movx @dptr, a ; load lsb of accumulator djnz r0, loop1 ; finish if last data bit ret ;****************************************************************************************** ;* name: rec_byte ;* description: receives byte from eeprom ;* function: this routine receives a byte, msb first, from the eeprom ;* calls: none ;* input: none ;* outputs: a = received byte ;* register usage: r0, r1, a ;****************************************************************************************** rec_byte: mov r0, #08 ; set bit counter to eight mov r1, #00 ; set register 1 to zero loop2: clr c ; set carry bit to '0' movx a, @dptr ; get data bit and store in lsb of acc jnb acc.0, zero_bit ; if lsb of accumulator '1' set carry bit to '1' setb c zero_bit: mov a, r1 ; load contents of register 1 to accumulator rlc a ; rotate accumulator left through carry mov r1, a ; load contents of accumulator to register 1 djnz r0, loop2 ; finish if last data bit ret ;****************************************************************************************** ;* name: rst ;* description: reset sequence ;* function: this routine sends the reset command sequence to the eeprom ;* calls: none ;* input: none ;* outputs: none ;* register usage: a ;****************************************************************************************** rst: movx a, @dptr ; read data bit mov a, #00h movx @dptr, a ; write data bit '0' movx a, @dptr ; read data bit ret ;****************************************************************************************** ;* name: nv_start ;* description: start nonvolatile write ;* function: this routine sends the command sequence to start the eeprom nonvolatile write ;* calls: none ;* input: none ;* outputs: none ;* register usage: a
xicor application note AN107-6 AN107 ;****************************************************************************************** nv_start: movx a, @dptr ; read data bit mov a, #01h movx @dptr, a ; write data bit '1' movx a, @dptr ; read data bit ret ;****************************************************************************************** ;* name: nv_poll ;* description: nonvolatile write polling ;* function: this routine polls for the completion of a nonvolatile eeprom write cycle ;* calls: none ;* input: none ;* outputs: none ;* register usage: r0, a ;****************************************************************************************** nv_poll: mov r0, #0ffh ; set counter to ffh loop3: movx a, @dptr ; read data bit nop ; delay nop ; delay nop ; delay jb acc.0, end_loop ; if data bit '1' nonvolatile cycle complete djnz r0, loop3 ; if data bit '0' nonvolatile cycle in progress end_loop: ret end


▲Up To Search▲   

 
Price & Availability of AN107

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X